import { NestFactory } from '@nestjs/core';
import { AppModule } from './controller/app.module';
// import { BusinessException, BusinessExceptionsFilter } from './helper/exception/catch-business-exception-filter';
// import { ValidationPipe } from '@nestjs/common';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.enableCors();
  // app.useGlobalPipes(
  //   new ValidationPipe({
  //     stopAtFirstError: true,
  //     transform: true,
  //     whitelist: true,
  //     transformOptions: {
  //       enableImplicitConversion: true,
  //     },
  //     exceptionFactory: (errors) => {
  //       const error = errors[0];
  //       const msg = Object.values(error.constraints).join('');
  //       return new BusinessException(msg);
  //     },
  //   }),
  // );
  // app.useGlobalFilters(new BusinessExceptionsFilter());
  await app.listen(3000);
}
bootstrap();
